<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>后台登录页面</title>
    <script src="../js/jquery-3.3.1.min.js"></script>
    <script src="../js/agree.js"></script>
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/iconfont.css">
    <link rel="stylesheet" href="../css/reg.css">
</head>
<body>
<div id="ajax-hook"></div>
<div class="wrap">
    <div class="wpn">
        <div class="form-data pos">
            <div class="change-login">
                <p class="account_number on">后台管理登录</p>
            </div>
            <div class="form1">
                <p class="p-input pos">
                    <label for="phone1">手机号</label>
                    <input type="text" id="phone1">
                </p>
                <p class="p-input pos">
                    <label for="password">请输入密码</label>
                    <input type="password" style="display:none" />
                    <input type="password" id="password" autocomplete="new-password">
                </p>
            </div>
            <button class="lang-btn off log-btn" id="loginbtn">登录</button>
            <div class="third-party">
                <a href="#" class="log-qq icon-qq-round"></a>
                <a href="#" class="log-qq icon-weixin"></a>
                <a href="#" class="log-qq icon-sina1"></a>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $(function () {
        //点击登录按钮
        selectLogin();
    })

    function selectLogin() {
        let ologinbtn = $("#loginbtn");
        let ophone1 = $("#phone1");
        let opassword = $("#password");
        ologinbtn.on("click", function () {
            $.ajax({
                async: true,
                url: "http://localhost:8080/zhihu1/back/admin?ac=selectLogin",
                type: "post",
                data: {
                    phone1: ophone1.val(),
                    password: opassword.val(),
                },
                dataType: "json",
                success: function (data) {
                    if (data.msg == "登录成功") {
                        location.href = "/zhihu1/back/admin?ac=tz"
                    } else {
                        alert("账号或密码错误！！！")
                    }
                }
            })
        })
    }
</script>
</html>